package com.qmmessage.sdk.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author qm
 */
public class ClientEnvUtil {
    private static final Properties PROP = new Properties();
    static {
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("qm-client-env.properties");
        try {
            if (in != null) {
                PROP.load(in);
            }
        } catch (IOException ignored) {
        }
    }

    /**
     * get client version
     *
     */
    public static String getClientVersion() {
        Object clientVersion = PROP.get("client_version");
        if (clientVersion != null) {
            return clientVersion.toString();
        }
        return "";
    }

    /**
     * get rest endpoint
     *
     */
    public static String getRestEndpoint() {
        Object restEndpoint = PROP.get("rest_endpoint");
        if (restEndpoint != null) {
            return restEndpoint.toString();
        }
        return "";
    }
}
